<html>

<script>
function Upload()
{
	//*
	var xmlhttp;
	if (window.XMLHttpRequest)
	{// code for IE7+, Firefox, Chrome, Opera, Safari
		xmlhttp=new XMLHttpRequest();
	}
	else
	{// code for IE6, IE5
		xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
	}
	xmlhttp.onreadystatechange=function()
	{
		if (xmlhttp.readyState==4 && xmlhttp.status==200)
		{
			var str = xmlhttp.responseText.split("\n")[2];
//			alert( str );
//			alert( str.search("/[") );
//			alert( str.search("/]") );
			jsonIDCategory=eval ("(" + str + ")");
			jsonIDCategory;
		}
	}
	var params = 'xml=<media id="0"/>';
	//Send the proper header information along with the request
	http.setRequestHeader("Content-type", "multipart/form-data");
//	http.setRequestHeader("Content-length", params.length);
//	http.setRequestHeader("Connection", "close");
	
	xmlhttp.open("POST","http://www.bespoke-app.com/BeSpokeAPI/UploadTest/upload.php",true);
	
	xmlhttp.send(params);
	/*/
	var method = 'POST';
    var url = 'http://www.bespoke-app.com/BeSpokeAPI/UploadTest/upload.php';
    var request = gen_multipart('Title', 'Description', binaryString, filetype);
    var xhr = new XMLHttpRequest();
    xhr.open(method, url, true);
    xhr.setRequestHeader("GData-Version", '3.0');
    xhr.setRequestHeader("Content-Type",  'multipart/related; boundary="END_OF_PART"');
    xhr.setRequestHeader("MIME-version", "1.0");
    // Add OAuth Token
    xhr.setRequestHeader("Authorization", oauth.getAuthorizationHeader(url, method, ''));
    xhr.onreadystatechange = function(data) {
        if (xhr.readyState == 4) {
            // .. handle response
        }
    };
    xhr.send(request);
	//*/
}
</script>

<body>

<form action="upload.php" method="post" enctype="multipart/form-data">
File Name:<input type="file" name="file" id="file"/>
<input type="hidden" name="xml" id="xml" value="<Media><Image File=1></Media>">
<input type="submit" name="submit" value="Upload"/>
</form>

</body>

</html>